# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dirb
pkgver=2.22
pkgrel=3
groups=('blackarch' 'blackarch-scanner' 'blackarch-webapp')
pkgdesc='A web content scanner, brute forcing for hidden files.'
url='http://dirb.sourceforge.net/'
arch=('x86_64' 'aarch64')
license=('GPL2')
depends=('curl')
source=("http://downloads.sourceforge.net/project/dirb/dirb/$pkgver/${pkgname}${pkgver//./}.tar.gz")
sha512sums=('57305160b11be9d48b44ece5848a102ab7a493a7ac30a44c31339fd7ca659866521ba621dc0639dc28bf21c3b5315390b934441590dac7d5b463e68df4b80b81')

prepare() {
  chmod -R 744 dirb${pkgver//./}

  #sed -i 's|wordlists/|/usr/share/dirb/wordlists/|' "dirb${pkgver//./}/src/dirb.c"
}

build () {
  cd "${pkgname}${pkgver//./}"

  ./configure --prefix=/usr

  make
}

package() {
  cd "${pkgname}${pkgver//./}"

  make DESTDIR="$pkgdir" install

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -a wordlists "$pkgdir/usr/share/$pkgname/"

  chmod -R 644 "$pkgdir/usr/share/$pkgname/wordlists"
  chmod -R +X "$pkgdir/usr/share/$pkgname/wordlists"

  # Fix conflict with extra/icu.
  mv "$pkgdir/usr/bin/gendict" "$pkgdir/usr/bin/dirb-gendict"
}

